package dhbw.GUI.Menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import dhbw.Data.Language;
import dhbw.Data.Settings;
import dhbw.GUI.Window.WindowChangePassword;
import dhbw.GUI.Window.WindowInfo;
import dhbw.GUI.Window.WindowOptions;
import dhbw.GUI.Window.WindowPersonalien;
import Main.MyController;

public class MenuHelp extends JMenu implements ActionListener {

	private JMenuItem infoItem;
	
	
	private JMenuItem optionsItem;
	private MyController myc;

	public MenuHelp(MyController myc) {
		this.myc = myc;
		buildMenu();
	}

	/**
	 * Build JMenu Help
	 */
	private void buildMenu() {
		infoItem = new JMenuItem(Language.INFO[myc.getLanguage()]);
		infoItem.setIcon(Settings.INFO_ICON);
		this.setText(Language.HELP[myc.getLanguage()]);
		optionsItem = new JMenuItem(Language.SETTINGS[myc.getLanguage()]);
		optionsItem.setIcon(Settings.SETTINGS_ICON);
		optionsItem.addActionListener(this);
		infoItem.addActionListener(this);
		this.add(infoItem);
		this.add(optionsItem);
	}

	@Override
	/**
	 * Click-Listener for JMenu
	 */
	public void actionPerformed(ActionEvent arg0) {
		if (arg0.getSource().equals(infoItem)) {
			new WindowInfo(this.myc);
		}
		if (arg0.getSource().equals(optionsItem)) {
			new WindowOptions(myc);
		}
	}
}
